home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / music4c.sit / Music4C Folder / SFConvert folder / SFConverttools.c < prev    next >
Text File  |  1990-06-25  |  2KB  |  131 lines

  1.  
  2. #define        NIL        0L
  3.  
  4.  
  5.  
  6.  
  7. void    DoOSErrorAlert(Str255, Str255);
  8. void    OutLineButton(DialogPtr, int);
  9. void    OSError(Str255, Str255);
  10. void    OSError2(Str255, Str255, OSErr);
  11.  
  12. void    PstringCopy(char *, char *);
  13. void    PstringCat(char *, char *);
  14.  
  15.  
  16. void    Wait(void);
  17.  
  18. int    stcisn(char *, char *);
  19.  
  20.  
  21.  
  22. void    OutLineButton(theDialog, itemNo)
  23.     DialogPtr    theDialog;
  24.     int        itemNo;
  25. {
  26.     int        itype;
  27.     Rect        buttonRect;
  28.     Handle    aHandl;
  29.     GrafPtr    tempPort;
  30.     
  31.     GetPort(&tempPort);
  32.     SetPort(theDialog);
  33.     GetDItem(theDialog, itemNo, &itype, &aHandl, &buttonRect);
  34.     PenSize(3,3);
  35.     InsetRect(&buttonRect, -4, -4); 
  36.     FrameRoundRect(&buttonRect, 16, 16);
  37.     PenSize(1,1);
  38.     SetPort(tempPort);
  39. }     
  40.     
  41. void    OSError(msg1, msg2)
  42.     Str255    msg1, msg2;
  43. {
  44.     short    i;
  45.     if (msg2)
  46.         ParamText(msg1, msg2, "\p", "\p");
  47.     else
  48.         ParamText(msg1, "\p", "\p", "\p");
  49.     i = StopAlert(600, NIL);
  50. }
  51.  
  52.  
  53. void    OSError2(msg1, msg2, theErr)
  54.     Str255    msg1, msg2;
  55.     OSErr    theErr;
  56. {
  57.     short    i;
  58.     Str255    aString;
  59.     
  60.     NumToString((long)theErr, &aString);
  61.     
  62.     if (msg2)
  63.         ParamText(msg1, msg2, aString, "\p");
  64.     else
  65.         ParamText(msg1, NIL, aString, "\p");
  66.     i = StopAlert(600, NIL);
  67. }
  68.  
  69. void    DoOSErrorAlert(mess1, mess2)
  70.     Str255 mess1, mess2;
  71. {
  72.     ParamText(mess1, mess2, "\p", "\p");
  73.     StopAlert(600, NIL);
  74. }
  75.  
  76. void PstringCopy(to, from)
  77.     char    *to, *from;
  78. {
  79.     char    *end = from + *from + 1;
  80.     for ( *to++ = *from++; from < end; )
  81.         *to++ = *from++;
  82. }
  83.  
  84. void    PstringCat(to, from)
  85.     char    *to, *from;
  86. {
  87.     register int i, length;
  88.     char    *p;
  89.     
  90.     length = *from;
  91.     p = to + *to + 1;
  92.     from++;
  93.     for ( i = 0; i < length; i++)    *p++ = *from++;
  94.     *to += length;
  95. }
  96.  
  97.  
  98. void    Wait()
  99. {
  100.     long    HowLong;
  101.     long    fTicks;
  102.     
  103.     HowLong = 120L;
  104.     Delay(HowLong, &fTicks);
  105. }
  106. /*-------------------------------------------------------------------------------*/
  107.  
  108.  
  109. int    stcisn(s, set)
  110.     register char *s;
  111.     char *set;
  112. {
  113. register char *t;
  114. register int count = 0;
  115. /* find position of set in s */
  116.     while (*s)
  117.     {
  118.         t = set;
  119.         while (*t && (*s != *t)) t++;
  120.         if (!*t)
  121.         {
  122.             s++;
  123.             count++;
  124.         }
  125.         else
  126.             break;
  127.     }
  128.     
  129.     return (count);
  130. }
  131.